﻿using System;
using System.Collections.Generic;
using System.Text;

namespace daSemanticAnalyser.SemanticTree
{
    using daSyntaxAnalyser.SyntaxTree;

    /// <summary>
    /// Свойство интерфейса
    /// </summary>
    public class InterfacePropertySemanticElement : UnitElementSemanticElement
    {
        private List<VarSemanticElement> indexes;
        private CommonTypeSemanticElement type;
        private string index;
        private PropertyOptionSemanticElement read, write, stored, _default;

        /// <summary>
        /// Индексаторы свойства
        /// </summary>
        public List<VarSemanticElement> Indexes { get { return indexes; } set { indexes = value; } }

        /// <summary>
        /// Тип свойства
        /// </summary>
        public CommonTypeSemanticElement Type { get { return type; } set { type = value; } }

        /// <summary>
        /// Индекс
        /// </summary>
        public string Index { get { return index; } set { index = value; } }

        /// <summary>
        /// Опция read
        /// </summary>
        public PropertyOptionSemanticElement Read { get { return read; } set { read = value; } }

        /// <summary>
        /// Опция write
        /// </summary>
        public PropertyOptionSemanticElement Write { get { return write; } set { write = value; } }

        /// <summary>
        /// Опция stored
        /// </summary>
        public PropertyOptionSemanticElement Stored { get { return stored; } set { stored = value; } }

        /// <summary>
        /// Опция default/nodefault
        /// </summary>
        public PropertyOptionSemanticElement Default { get { return _default; } set { _default = value; } }

        /// <summary>
        /// Конструктор
        /// </summary>
        /// <param name="Name">имя элемента</param>
        /// <param name="Parent">родитель свойства</param>
        /// <param name="Unit">модуль, содержащий свойство</param>
        /// <param name="Indexes">индексаторы свойства</param>
        /// <param name="Type">тип свойства</param>
        /// <param name="Index">индекс</param>
        /// <param name="Read">опция read</param>
        /// <param name="Write">опция write</param>
        /// <param name="Stored">опция stored</param>
        /// <param name="Default">опция default/nodefault</param>
        /// <param name="SyntaxElement">соответствующий элемент синтаксического дерева</param>
        public InterfacePropertySemanticElement(string Name, IChildSemanticElement Parent, FileSemanticElement Unit, List<VarSemanticElement> Indexes, CommonTypeSemanticElement Type, string Index, PropertyOptionSemanticElement Read, PropertyOptionSemanticElement Write, PropertyOptionSemanticElement Stored, PropertyOptionSemanticElement Default, ISyntaxTreeElement SyntaxElement)
            : base(Name, Parent, Unit, SyntaxElement)
        {
            indexes = (Indexes == null) ? new List<VarSemanticElement>() : Indexes;
            type = Type;
            index = Index;
            read = Read;
            write = Write;
            stored = Stored;
            _default = Default;
        }
    }
}
